<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <!-- <vant-swipe class="my-swipe" v-for="(item,index) in swiperList" :key="id" :autoplay="3000" indicator-color="white">
      <vant-swipe-item>{{items.img.url}}</vant-swipe-item>-->
      <!-- <vant-swipe-item>1</vant-swipe-item>
      <vant-swipe-item>2</vant-swipe-item>
      <vant-swipe-item>3</vant-swipe-item>
      <vant-swipe-item>4</vant-swipe-item>-->
      <van-swipe-item v-for="(item,index) in banner" :key="index">
        <img :src="item.url" alt />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>
<script>
import { Swipe, SwipeItem } from "vant";
export default {
  name: "swipe",
  props: {
    //单向流
    banner: {
      type: Array,
      default: function() {
        return [];
      }
    }
  },
  components: {
    vanSwipe: Swipe,
    vanSwipeItem: SwipeItem
  },
  data() {
    // swiperList:[];
    return {
      // swiperList: [
      //   // console.log(swiperList),
      //   {
      //     id: 1,
      //     name: "首页置顶",
      //     description: "首页轮播图",
      //     update_time: "1970-01-01 08:00:00",
      //     items: [
      //       {
      //         key_word: "6",
      //         type: 1,
      //         update_time: "1970-01-01 08:00:00",
      //         img: {
      //           url: "https://yc211.cn:88/images/banner-4a.png",
      //           update_time: "1970-01-01 08:00:00"
      //         }
      //       },
      //       {
      //         key_word: "25",
      //         type: 1,
      //         update_time: "1970-01-01 08:00:00",
      //         img: {
      //           url: "https://yc211.cn:88/images/banner-2a.png",
      //           update_time: "1970-01-01 08:00:00"
      //         }
      //       },
      //       {
      //         key_word: "11",
      //         type: 1,
      //         update_time: "1970-01-01 08:00:00",
      //         img: {
      //           url: "https://yc211.cn:88/images/banner-3a.png",
      //           update_time: "1970-01-01 08:00:00"
      //         }
      //       },
      //       {
      //         key_word: "10",
      //         type: 1,
      //         update_time: "1970-01-01 08:00:00",
      //         img: {
      //           url: "https://yc211.cn:88/images/banner-1a.png",
      //           update_time: "1970-01-01 08:00:00"
      //         }
      //       }
      //     ]
      //   }
      // ]
    };
  }
};
</script>
<style lang="scss">
.my-swipe {
  .van-swipe__indicator {
    width: 0.35rem;
    height: 0.35rem;
    background-color: #ccc;
  }
}
</style>
<style lang="scss" scoped>
.my-swipe {
  height: 8rem;
  width: 100%;
  img {
    height: 100%;
    width: 100%;
  }
}
</style>